<template>
  <div class="flow-design-container">
    <div class="page-header">
      <div class="header-left">
        <el-button @click="handleBack">
          <el-icon><ArrowLeft /></el-icon>
          返回
        </el-button>
        <h2>{{ isEdit ? '编辑审批流' : '新建审批流' }}</h2>
      </div>
      <div class="header-right">
        <el-button @click="handleCancel">取消</el-button>
        <el-button type="primary" @click="handleSave">保存</el-button>
      </div>
    </div>

    <div class="design-content">
      <el-tabs v-model="activeTab" class="design-tabs">
        <el-tab-pane label="基础设置" name="basic">
          <basic-settings v-model="formData" />
        </el-tab-pane>

        <el-tab-pane label="表单设计" name="form">
          <form-designer v-model="formItems" />
        </el-tab-pane>

        <el-tab-pane label="流程设计" name="process">
          <process-designer v-model="processNodes" />
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import BasicSettings from './flow-design/BasicSettings.vue'
import FormDesigner from './flow-design/FormDesigner.vue'
import ProcessDesigner from './flow-design/ProcessDesigner.vue'

const router = useRouter()
const activeTab = ref('basic')
const isEdit = ref(false)

// 表单数据
const formData = ref({
  name: '',
  icon: '',
  category: '',
  description: ''
})

// 表单项列表
const formItems = ref([])

// 流程节点列表
const processNodes = ref([
  {
    type: 'approval',
    name: '审批节点',
    icon: 'User',
    approver: 'manager',
    approvalType: 'or'
  }
])

// 页面操作
const handleBack = () => {
  router.push('/oa')
}

const handleCancel = () => {
  router.push('/oa')
}

const handleSave = () => {
  ElMessage.success('保存成功')
  router.push('/oa')
}
</script>

<style scoped>
/* ... 保持原有样式 ... */
</style> 